package refactortips.editors.codeSmells;

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.wb.swt.SWTResourceManager;

import refactortips.editors.AbstractRefactorTipsEditor;
import refactortips.editors.CommandMouseAdapter;

public class AlternativeClassesWithDifferentInterfacesEditor extends AbstractRefactorTipsEditor {

	protected final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
	
	public AlternativeClassesWithDifferentInterfacesEditor() {
	}

	/**
	 * Create contents of the editor part.
	 * @param parent
	 */
	@Override
	public void createPartControl(Composite parent) {
		
		Form frmCodeSmell = formToolkit.createForm(parent);
		formToolkit.paintBordersFor(frmCodeSmell);
		frmCodeSmell.setText("Alternative Classes with Different Interfaces");
		frmCodeSmell.getBody().setLayout(new FillLayout(SWT.HORIZONTAL));
		
		TabFolder tabFolder = new TabFolder(frmCodeSmell.getBody(), SWT.NONE);
		formToolkit.adapt(tabFolder);
		formToolkit.paintBordersFor(tabFolder);
		
		ScrolledComposite sc = new ScrolledComposite(tabFolder, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
		sc.setExpandHorizontal(true);
	    sc.setExpandVertical(true);
		
		TabItem tbtmDescription = new TabItem(tabFolder, SWT.NONE);
		tbtmDescription.setText("Descri\u00E7\u00E3o");
		
		ScrolledComposite scrolledComposite = new ScrolledComposite(tabFolder, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
		tbtmDescription.setControl(scrolledComposite);
		formToolkit.paintBordersFor(scrolledComposite);
		scrolledComposite.setExpandHorizontal(true);
		scrolledComposite.setExpandVertical(true);
		
		Composite composite_3 = new Composite(scrolledComposite, SWT.NONE);
		formToolkit.adapt(composite_3);
		formToolkit.paintBordersFor(composite_3);
		composite_3.setLayout(null);
		
		Label lblDescription = new Label(composite_3, SWT.NONE);
		lblDescription.setBounds(10, 10, 102, 25);
		lblDescription.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
		lblDescription.setFont(SWTResourceManager.getFont("Segoe UI", 14, SWT.BOLD));
		formToolkit.adapt(lblDescription, true, true);
		lblDescription.setText("Descri\u00E7\u00E3o");
		
		Link linkRenameMethod = new Link(composite_3, SWT.NONE);
		linkRenameMethod.setBounds(113, 60, 115, 21);
		linkRenameMethod.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
		linkRenameMethod.addMouseListener(new CommandMouseAdapter(getSite(), "RefactorTips.commands.renameMethodCommand"));
		formToolkit.adapt(linkRenameMethod, true, true);
		linkRenameMethod.setText("<a>Rename Method</a>");
		
		Link linkMoveMethod = new Link(composite_3, 0);
		linkMoveMethod.setText("<a>Move Method</a>");
		linkMoveMethod.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
		linkMoveMethod.setBounds(366, 102, 97, 21);
		formToolkit.adapt(linkMoveMethod, true, true);
		
		Link linkExtractSuperclass = new Link(composite_3, 0);
		linkExtractSuperclass.setText("<a>Extract Superclass</a>");
		linkExtractSuperclass.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
		linkExtractSuperclass.setBounds(278, 144, 124, 21);
		formToolkit.adapt(linkExtractSuperclass, true, true);
		
		StyledText styledText = new StyledText(composite_3, SWT.READ_ONLY | SWT.WRAP);
		styledText.setText("\t\tUse \t\t\t\t\t\t\t\t\t em qualquer m\u00E9todo que faz a mesma coisa mas tem assinaturas diferentes dado o que eles fazem. Frequentemente isso n\u00E3o vai longe o suficiente. Nesses casos as classes ainda n\u00E3o est\u00E3o fazendo o suficiente. Continue usando \t\t\t\t\t\t\t\tpara mover comportamento para as classes at\u00E9 que os protocolos sejam o mesmo. Se voc\u00EA tiver que mover c\u00F3digo redundantemente para executar isso, voc\u00EA pode ser capaz de usar\t\t\t\t\t\t\t\t\tpara reparar.");
		styledText.setJustify(true);
		styledText.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
		styledText.setEnabled(false);
		styledText.setDoubleClickEnabled(false);
		styledText.setBounds(44, 60, 738, 141);
		formToolkit.adapt(styledText);
		formToolkit.paintBordersFor(styledText);
		scrolledComposite.setContent(composite_3);
		scrolledComposite.setMinSize(composite_3.computeSize(SWT.DEFAULT, SWT.DEFAULT));
		
		TabItem tbtmUsage = new TabItem(tabFolder, SWT.NONE);
		tbtmUsage.setText("Exemplo");
		
		ScrolledComposite scrolledComposite_1 = new ScrolledComposite(tabFolder, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
		tbtmUsage.setControl(scrolledComposite_1);
		formToolkit.paintBordersFor(scrolledComposite_1);
		scrolledComposite_1.setExpandHorizontal(true);
		scrolledComposite_1.setExpandVertical(true);
		
		Composite composite = new Composite(scrolledComposite_1, SWT.NONE);
		formToolkit.adapt(composite);
		formToolkit.paintBordersFor(composite);
		scrolledComposite_1.setContent(composite);
		scrolledComposite_1.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
		
		TabItem tbtmVideo = new TabItem(tabFolder, SWT.NONE);
		tbtmVideo.setText("Video");
		
		Browser browser = new Browser(tabFolder, SWT.NONE);
		browser.setUrl("");
		tbtmVideo.setControl(browser);
		formToolkit.paintBordersFor(browser);
	}
}
